<template>
  <div>
    <h1>列表</h1>
    <ul>
      <li v-for="item in products" :key="item._id">
        <router-link :to="`/detail/${item.productId}`">{{
          item.productName
        }}</router-link>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      products: [],
    };
  },
  mounted() {
    fetch("http://chst.vip:1234/api/getmoneyctrl")
      .then((body) => body.json())
      .then((res) => {
        // console.log(res.result);
        this.products = res.result;
      });

    console.log(this.$route);
  },
};
</script>
